import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "layout",
    meta: { title: "布局" },
    component: () => import("../views/layout/Layout.vue"),
    redirect: "/home",
    children: [
      {
        path: "/home",
        name: "home",
        meta: { title: "首页" },
        component: () => import("../views/home/Home.vue" as any),
      },
    ],
  },
  {
    path: "/details",
    name: "details",
    meta: { title: "详情页" },
    component: () => import("../views/detailPage/DetailPage.vue"),
    redirect: "/details/building",
    children: [
      {
        path: "building",
        name: "building",
        meta: { title: "建筑详情" },
        component: () => import("../views/buildingDetails/BuildingDetails.vue"),
      },
    ],
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router
